use strict;
use warnings;

PluginsTest->runtests;


package PluginsTest;
use base qw/Test::Class/;
use Test::More;
use File::Basename;

use MT::App::Test;

sub init_app : Test(setup) {
	my $self = shift;
	$self->{app} = MT::App::Test->test_instance_of(
		force_initialize_database => 1,
		data_dirs => dirname(File::Spec->rel2abs(__FILE__)),
	);
}

sub plugins_test : Test(1) {
	my $self = shift;
	my $app = $self->{app};

	my $plugin = $app->component('MultiBlog');

	my $yaml_file = File::Spec->catfile(
		dirname(__FILE__), 'plugindatas', 'MultiBlog.yaml'
	);
	my $yaml = YAML::Tiny->read($yaml_file);
	my $data = $yaml->[0];

	my $hash = $plugin->get_config_hash('blog:1');
	foreach my $k (keys %{ $data->{'blog:1'} }) {
		is($hash->{$k}, $data->{'blog:1'}{$k}, "config data " . $k);
	}
}

1;
